package com.love.marriage.job;

import com.love.marriage.userMembershipInfo.service.UserMemberPrivilegeService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@EnableScheduling
@RequiredArgsConstructor
@Slf4j
public class MemberPrivilegeJob {

    private final UserMemberPrivilegeService userMemberPrivilegeService;

    // 添加@schedual
    @Scheduled(cron = "5 0 0 * * ?")
    public void addMemberPrivilege() throws WxErrorException {
        log.info("开始更新每日会员权益");
        userMemberPrivilegeService.addMemberPrivilege(null);
        log.info("每日更新用户匹配信息，结束====================");
    }
}
